package org.springblade.modules.notice.core.conditon.impl;

import org.springblade.modules.notice.core.conditon.TriggerConditionFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author ysq
 * @Date 2024/12/06
 * @Description 任务指派后，已停梯1/2/4小时，工单未签到
 */
@Component
public class Condition6And7And8Handler implements TriggerConditionFactory {

	@Resource
	private JdbcTemplate jdbcTemplate;

	private static final String C_6_7_8_SQL = "SELECT count(id)=0 FROM blade_maintain_sign WHERE plan_id = ?";
	@Override
	public boolean isTrigger(Long bizId) {
		try {
			return jdbcTemplate.queryForObject(C_6_7_8_SQL, new Object[]{bizId}, boolean.class);
		} catch (DataAccessException e) {
			return false;
		}
	}
}
